-
Notifications
You must be signed in to change notification settings - Fork 794
Harden db defined type #1484
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Harden db defined type #1484
Conversation
25efcd2
to
4718bba
Compare
4718bba
to
ca03fb2
Compare
I don't think that One could argue for the ability to specify a full path, like |
I think we should have it as an enum with the most common options in there. We can always accept PRs for new ones |
Enum sounds sensible to me... and actually removes a breaking element of the change. |
Prior to this commit there was a possibility that malformed strings could be passed in to the resource. This could lead to unsafe executions on a remote system. The parameters that are susceptible are `dbname`, `sql` and `import_cat_cmd`. In addition, commands were not properly broken out in to arrays of arguments when passed to the exec resource. This commit fixes the above by adding validation to parameters (where possible) to ensure that the given values conform to expectation. `dbname` is validated with a regular expression that ensures that it matches expectations set by mysql. `sql` now only accepts values as an `Array[String]`. This can be one or more value. Values are also validated with a regular expression that ensures that the given paths are valid. `import_cat_cmd` has been removed in favour of a boolean parameter called `use_zcat`. Setting this parameter to `true` will set the value of the private `import_cat_cmd` to `zcat`. This commit also contains some minor refactoring.
This commit adds spec tests for the the changes made in the previous commit.
This commit fixes some small issues where tests were failing because of a type mismatch.
ca03fb2
to
603287f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do think that we need bzcat in the command options, otherwise this looks good
Co-authored-by: Ben Ford <ben.ford@puppetlabs.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all LGTM
This has already been merged, but .. you can easily support both string and array in the
|
Hello, is this the fix for CVE-2022-3276 or are #1487 #1486 1485 also needed to resolve it ? |
You will need all of them. We recommend consuming the latest major release. |
Prior to this commit there was a possibility that malformed strings could be passed in to the resource.
This could lead to unsafe executions on a remote system.
The parameters that are susceptible are
dbname
,sql
andimport_cat_cmd
.In addition, commands were not properly broken out in to arrays of arguments when passed to the exec resource.
This commit fixes the above by adding validation to parameters (where possible) to ensure that the given values conform to expectation.
dbname
is validated with a regular expression that ensures that it matches expectations set by mysql.sql
now only accepts values as anArray[String]
.This can be one or more value.
Values are also validated with a regular expression that ensures that the given paths are valid.
import_cat_cmd
has been removed in favour of a boolean parameter calleduse_zcat
.Setting this parameter to
true
will set the value of the privateimport_cat_cmd
tozcat
.This commit also contains some minor refactoring.